<%@ page contentType="text/html;charset=UTF-8"%>
<%@include file="../../common/sessionValidate.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html lang="UTF-8">
<head>
    <title>T_news信息维护</title>
    <%@ include file="../../common/meta.jsp"%>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <link rel="stylesheet" href="<%=basePath%>css/my-bootstrap.css" media="screen"  id="tuserskin">
    <link rel="stylesheet" href="<%=basePath%>js/toastr/toastr.css">
    <link rel="stylesheet" href="<%=basePath%>css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css">
    <script type="text/javascript" src="<%= basePath %>js/jquery.cookie.js"></script>
</head>
<style>
    hr {
        margin-top:1px;
        border-bottom: 1px solid #1BBC9B;
    }
</style>
<body>
<div class="" style="margin-right:2px;padding-right:1px;">

    <!--------------------------查询条件表格  start------------------------------->

    <!-- 查询面板 -->
    <div class="panel panel-primary" id="cxDiv">
        <!-- Default panel contents -->
        <div class="panel-heading  " >
            <i class='icon-filter'></i>&nbsp;名片信息导入
        </div>
        <div class="panel-body" id="shDiv" class="panel-collapse collapse in">

            <form name="ffAdd" id="ffAdd" target=""  enctype="multipart/form-data" method="post"  >
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-xs-5">名片信息上传批量导入(.xls结尾的Excel文件)</label>
                        <div class="col-xs-7" align="left" style="border: 1px;">
                            <input type="file"  style=" border: 1px; border-color: #2a85a0" id="uploadExcelFile" name="uploadExcelFile">
                            <iframe style="display: none" name="hide_iframe" id="hide_iframe"></iframe>
                        </div>
                    </div>
                </div>
                <div class="col-xs-3">
                    <div class="form-group">
                        <label class="control-label col-xs-3" style="">
                            <input type="button"  id="sb" value="上传" name="sb"  onclick="add()" >
                        </label>
                        <div class="col-xs-7">

                        </div>
                    </div>
                </div>
                <div class="col-xs-3">
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="button"  id="fh" value="返回名片管理" name="sb"  onclick="toList()" >
                        </div>
                    </div>
                </div>

            </form>

        </div>
    </div>

    <!--------------------------查询条件表格end------------------------------------->

</div>
</body>
</html>

<script src="<%=basePath%>js/bootstrap.min.js"></script>
<!--<script src="<%=basePath%>js/jquery-1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrapValidator.js"></script>-->
<script src="<%=basePath%>js/bootstrap-paginator.min.js"></script>
<script src="<%=basePath%>/js/respond.js"></script>
<script src="<%=basePath%>/js/html5.js"></script>
<script src="<%=basePath%>js/toastr/toastr.js"></script>
<script src="<%=basePath%>js/bootbox.js"></script>
<script src="<%=basePath%>js/jquery.validate.js"></script>
<!-- <script src="<%=basePath%>js/additional-methods.min.js"></script> -->
<script src="<%=basePath%>js/my-jquery-curd.js"></script>
<script src="<%= basePath %>js/tableSortTool.js" ></script>
<script src="<%= basePath %>js/calendar.js" ></script>
<!-- 禁止右键刷新 -->
<script src="<%= basePath %>js/jinzhishuaxin.js" ></script>

<script type="text/javascript">
    $().ready(function(){
        var flag = "<%= request.getParameter("flag") %>";
        //当flag=="1"时，说明是从前面页面菜单跳转过来的，如果是没值，说明是从controller跳过来的；
        if(flag != "1"){
            var resultString = "<%= request.getAttribute("resultString") %>";
            //返回字符串时用如下方案
            if (resultString=="success") {
                //保存成功  1.关闭弹出层，
                flag = "1";
                showSuccessTips("恭喜保存成功!", "提示");
            }
            else {
                showErrorTips("保存数据失败!", "错误信息："+resultString);
            }
        }
    }) //end funciton read;

    //新增保存数据
    function add() {
        var uploadExcelFile = $("#uploadExcelFile").val();
        if(uploadExcelFile==""||uploadExcelFile==null){
            alert("文件不能为空，请选择文件！");
            $("#uploadExcelFile").focus();
            return false;
        }
        //判断是否为.xls文件；
        var filesuf= uploadExcelFile.substring(uploadExcelFile.lastIndexOf(".")+1);
        //alert(filesuf); //如：txt
        if(filesuf!=="xls"){
            alert("选择的上传库存文件必须是以'.xls'结尾的Excel格式文件！");
            $("#uploadExcelFile").focus();
            return false;
        }

        //$("#addSaveButton").attr("disabled", true);
        var url = "<%=basePath%>excelController/excelUploadMingpian?1=1&time="+Math.random();
        //直接提交表单；jquery $.ajax和$.post不能提交file的
        //你可以在页bai面放一个隐藏的iframe 然后du让表单提zhi交到这个iframe
        //alert("url="+url);
        ffAdd.action =  url;
        ffAdd.submit();
        //$("#uploadExcelFile").val("");
    }

    //通过选择单条记录，点击‘查看‘按钮进行查看
    function toList(){
        self.location= "<%=basePath%>t_news/toT_newsListMingpian?1=1&biztype=wuye&time="+Math.random();;
    }
</script>
